#include "include/types.h"
// a user program that calls exec("/init")
// od -t xC initcode
#ifdef _cmd
uchar initcode[] = {
  0x17, 0x05, 0x00, 0x00, 0x13, 0x05, 0x45, 0x02,
  0x97, 0x05, 0x00, 0x00, 0x93, 0x85, 0x35, 0x02,
  0x93, 0x08, 0x70, 0x00, 0x73, 0x00, 0x00, 0x00,
  0x93, 0x08, 0x20, 0x00, 0x73, 0x00, 0x00, 0x00,
  0xef, 0xf0, 0x9f, 0xff, 0x2f, 0x69, 0x6e, 0x69,
  0x74, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00,
};
#endif

#ifdef _runall
/*
uchar initcode[] = {
	0x17, 0x05, 0x00, 0x00, 0x13, 0x05, 0x45, 0x02,
	0x97, 0x05, 0x00, 0x00, 0x93, 0x85, 0x25, 0x02, 
	0x93, 0x08, 0x70, 0x00, 0x73, 0x00, 0x00, 0x00, 
	0x93, 0x08, 0x20, 0x00, 0x73, 0x00, 0x00, 0x00, 
	0xef, 0xf0, 0x9f, 0xff, 0x2f, 0x62, 0x72, 0x6b, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
};
*/

uchar initcode[] = {
	0x17, 0x05, 0x00, 0x00, 0x13, 0x05, 0x45, 0x32, 
	0x97, 0x05, 0x00, 0x00, 0x93, 0x85, 0x25, 0x43, 
	0x93, 0x08, 0x70, 0x00, 0x73, 0x00, 0x00, 0x00, 
	0x17, 0x05, 0x00, 0x00, 0x13, 0x05, 0x55, 0x31, 
	0x97, 0x05, 0x00, 0x00, 0x93, 0x85, 0xa5, 0x41, 
	0x93, 0x08, 0x70, 0x00, 0x73, 0x00, 0x00, 0x00, 
	0x17, 0x05, 0x00, 0x00, 0x13, 0x05, 0x45, 0x30, 
	0x97, 0x05, 0x00, 0x00, 0x93, 0x85, 0x25, 0x40, 
	0x93, 0x08, 0x70, 0x00, 0x73, 0x00, 0x00, 0x00, 
	0x17, 0x05, 0x00, 0x00, 0x13, 0x05, 0x55, 0x2f, 
	0x97, 0x05, 0x00, 0x00, 0x93, 0x85, 0xa5, 0x3e, 
	0x93, 0x08, 0x70, 0x00, 0x73, 0x00, 0x00, 0x00, 
	0x17, 0x05, 0x00, 0x00, 0x13, 0x05, 0x35, 0x2e, 
	0x97, 0x05, 0x00, 0x00, 0x93, 0x85, 0x25, 0x3d, 
	0x93, 0x08, 0x70, 0x00, 0x73, 0x00, 0x00, 0x00, 
	0x17, 0x05, 0x00, 0x00, 0x13, 0x05, 0x25, 0x2d, 
	0x97, 0x05, 0x00, 0x00, 0x93, 0x85, 0xa5, 0x3b, 
	0x93, 0x08, 0x70, 0x00, 0x73, 0x00, 0x00, 0x00, 
	0x17, 0x05, 0x00, 0x00, 0x13, 0x05, 0x25, 0x2c, 
	0x97, 0x05, 0x00, 0x00, 0x93, 0x85, 0x25, 0x3a, 
	0x93, 0x08, 0x70, 0x00, 0x73, 0x00, 0x00, 0x00, 
	0x17, 0x05, 0x00, 0x00, 0x13, 0x05, 0x25, 0x2b, 
	0x97, 0x05, 0x00, 0x00, 0x93, 0x85, 0xa5, 0x38, 
	0x93, 0x08, 0x70, 0x00, 0x73, 0x00, 0x00, 0x00, 
	0x17, 0x05, 0x00, 0x00, 0x13, 0x05, 0x35, 0x2a, 
	0x97, 0x05, 0x00, 0x00, 0x93, 0x85, 0x25, 0x37, 
	0x93, 0x08, 0x70, 0x00, 0x73, 0x00, 0x00, 0x00, 
	0x17, 0x05, 0x00, 0x00, 0x13, 0x05, 0x35, 0x29, 
	0x97, 0x05, 0x00, 0x00, 0x93, 0x85, 0xa5, 0x35, 
	0x93, 0x08, 0x70, 0x00, 0x73, 0x00, 0x00, 0x00, 
	0x17, 0x05, 0x00, 0x00, 0x13, 0x05, 0x35, 0x28, 
	0x97, 0x05, 0x00, 0x00, 0x93, 0x85, 0x25, 0x34, 
	0x93, 0x08, 0x70, 0x00, 0x73, 0x00, 0x00, 0x00, 
	0x17, 0x05, 0x00, 0x00, 0x13, 0x05, 0x35, 0x27, 
	0x97, 0x05, 0x00, 0x00, 0x93, 0x85, 0xa5, 0x32, 
	0x93, 0x08, 0x70, 0x00, 0x73, 0x00, 0x00, 0x00, 
	0x17, 0x05, 0x00, 0x00, 0x13, 0x05, 0x25, 0x26, 
	0x97, 0x05, 0x00, 0x00, 0x93, 0x85, 0x25, 0x31, 
	0x93, 0x08, 0x70, 0x00, 0x73, 0x00, 0x00, 0x00, 
	0x17, 0x05, 0x00, 0x00, 0x13, 0x05, 0x95, 0x25, 
	0x97, 0x05, 0x00, 0x00, 0x93, 0x85, 0xa5, 0x2f, 
	0x93, 0x08, 0x70, 0x00, 0x73, 0x00, 0x00, 0x00, 
	0x17, 0x05, 0x00, 0x00, 0x13, 0x05, 0x85, 0x24, 
	0x97, 0x05, 0x00, 0x00, 0x93, 0x85, 0x25, 0x2e, 
	0x93, 0x08, 0x70, 0x00, 0x73, 0x00, 0x00, 0x00, 
	0x17, 0x05, 0x00, 0x00, 0x13, 0x05, 0x75, 0x23, 
	0x97, 0x05, 0x00, 0x00, 0x93, 0x85, 0xa5, 0x2c, 
	0x93, 0x08, 0x70, 0x00, 0x73, 0x00, 0x00, 0x00, 
	0x17, 0x05, 0x00, 0x00, 0x13, 0x05, 0x85, 0x22, 
	0x97, 0x05, 0x00, 0x00, 0x93, 0x85, 0x25, 0x2b, 
	0x93, 0x08, 0x70, 0x00, 0x73, 0x00, 0x00, 0x00, 
	0x17, 0x05, 0x00, 0x00, 0x13, 0x05, 0x85, 0x21, 
	0x97, 0x05, 0x00, 0x00, 0x93, 0x85, 0xa5, 0x29, 
	0x93, 0x08, 0x70, 0x00, 0x73, 0x00, 0x00, 0x00, 
	0x17, 0x05, 0x00, 0x00, 0x13, 0x05, 0x95, 0x20, 
	0x97, 0x05, 0x00, 0x00, 0x93, 0x85, 0x25, 0x28, 
	0x93, 0x08, 0x70, 0x00, 0x73, 0x00, 0x00, 0x00, 
	0x17, 0x05, 0x00, 0x00, 0x13, 0x05, 0xa5, 0x1f, 
	0x97, 0x05, 0x00, 0x00, 0x93, 0x85, 0xa5, 0x26, 
	0x93, 0x08, 0x70, 0x00, 0x73, 0x00, 0x00, 0x00, 
	0x17, 0x05, 0x00, 0x00, 0x13, 0x05, 0xb5, 0x1e, 
	0x97, 0x05, 0x00, 0x00, 0x93, 0x85, 0x25, 0x25, 
	0x93, 0x08, 0x70, 0x00, 0x73, 0x00, 0x00, 0x00, 
	0x17, 0x05, 0x00, 0x00, 0x13, 0x05, 0xe5, 0x1d, 
	0x97, 0x05, 0x00, 0x00, 0x93, 0x85, 0xa5, 0x23, 
	0x93, 0x08, 0x70, 0x00, 0x73, 0x00, 0x00, 0x00, 
	0x17, 0x05, 0x00, 0x00, 0x13, 0x05, 0xe5, 0x1c, 
	0x97, 0x05, 0x00, 0x00, 0x93, 0x85, 0x25, 0x22, 
	0x93, 0x08, 0x70, 0x00, 0x73, 0x00, 0x00, 0x00, 
	0x17, 0x05, 0x00, 0x00, 0x13, 0x05, 0xe5, 0x1b, 
	0x97, 0x05, 0x00, 0x00, 0x93, 0x85, 0xa5, 0x20, 
	0x93, 0x08, 0x70, 0x00, 0x73, 0x00, 0x00, 0x00, 
	0x17, 0x05, 0x00, 0x00, 0x13, 0x05, 0x05, 0x1b, 
	0x97, 0x05, 0x00, 0x00, 0x93, 0x85, 0x25, 0x1f, 
	0x93, 0x08, 0x70, 0x00, 0x73, 0x00, 0x00, 0x00, 
	0x17, 0x05, 0x00, 0x00, 0x13, 0x05, 0xf5, 0x19, 
	0x97, 0x05, 0x00, 0x00, 0x93, 0x85, 0xa5, 0x1d, 
	0x93, 0x08, 0x70, 0x00, 0x73, 0x00, 0x00, 0x00, 
	0x17, 0x05, 0x00, 0x00, 0x13, 0x05, 0xf5, 0x18, 
	0x97, 0x05, 0x00, 0x00, 0x93, 0x85, 0x25, 0x1c, 
	0x93, 0x08, 0x70, 0x00, 0x73, 0x00, 0x00, 0x00, 
	0x17, 0x05, 0x00, 0x00, 0x13, 0x05, 0xf5, 0x17, 
	0x97, 0x05, 0x00, 0x00, 0x93, 0x85, 0xa5, 0x1a, 
	0x93, 0x08, 0x70, 0x00, 0x73, 0x00, 0x00, 0x00, 
	0x17, 0x05, 0x00, 0x00, 0x13, 0x05, 0x05, 0x17, 
	0x97, 0x05, 0x00, 0x00, 0x93, 0x85, 0x25, 0x19, 
	0x93, 0x08, 0x70, 0x00, 0x73, 0x00, 0x00, 0x00, 
	0x17, 0x05, 0x00, 0x00, 0x13, 0x05, 0xe5, 0x15, 
	0x97, 0x05, 0x00, 0x00, 0x93, 0x85, 0xa5, 0x17, 
	0x93, 0x08, 0x70, 0x00, 0x73, 0x00, 0x00, 0x00, 
	0x17, 0x05, 0x00, 0x00, 0x13, 0x05, 0xd5, 0x14, 
	0x97, 0x05, 0x00, 0x00, 0x93, 0x85, 0x25, 0x16, 
	0x93, 0x08, 0x70, 0x00, 0x73, 0x00, 0x00, 0x00, 
	0x17, 0x05, 0x00, 0x00, 0x13, 0x05, 0xf5, 0x13, 
	0x97, 0x05, 0x00, 0x00, 0x93, 0x85, 0xa5, 0x14, 
	0x93, 0x08, 0x70, 0x00, 0x73, 0x00, 0x00, 0x00, 
	0x17, 0x05, 0x00, 0x00, 0x13, 0x05, 0xe5, 0x12, 
	0x97, 0x05, 0x00, 0x00, 0x93, 0x85, 0x25, 0x13, 
	0x93, 0x08, 0x70, 0x00, 0x73, 0x00, 0x00, 0x00, 
	0x93, 0x08, 0x20, 0x00, 0x73, 0x00, 0x00, 0x00, 
	0xef, 0xf0, 0x9f, 0xff, 0x2f, 0x6f, 0x70, 0x65, 
	0x6e, 0x61, 0x74, 0x00, 0x00, 0x2f, 0x70, 0x69, 
	0x70, 0x65, 0x00, 0x00, 0x2f, 0x75, 0x6e, 0x6c, 
	0x69, 0x6e, 0x6b, 0x00, 0x00, 0x2f, 0x62, 0x72, 
	0x6b, 0x00, 0x00, 0x2f, 0x66, 0x6f, 0x72, 0x6b, 
	0x00, 0x00, 0x2f, 0x77, 0x72, 0x69, 0x74, 0x65, 
	0x00, 0x00, 0x2f, 0x66, 0x73, 0x74, 0x61, 0x74, 
	0x00, 0x00, 0x2f, 0x75, 0x6d, 0x6f, 0x75, 0x6e, 
	0x74, 0x00, 0x00, 0x2f, 0x6d, 0x6f, 0x75, 0x6e, 
	0x74, 0x00, 0x00, 0x2f, 0x74, 0x69, 0x6d, 0x65, 
	0x73, 0x00, 0x00, 0x2f, 0x63, 0x6c, 0x6f, 0x73, 
	0x65, 0x00, 0x00, 0x2f, 0x6d, 0x6d, 0x61, 0x70, 
	0x00, 0x00, 0x2f, 0x67, 0x65, 0x74, 0x74, 0x69, 
	0x6d, 0x65, 0x6f, 0x66, 0x64, 0x61, 0x79, 0x00, 
	0x00, 0x2f, 0x65, 0x78, 0x69, 0x74, 0x00, 0x00, 
	0x2f, 0x72, 0x65, 0x61, 0x64, 0x00, 0x00, 0x2f, 
	0x67, 0x65, 0x74, 0x70, 0x69, 0x64, 0x00, 0x00, 
	0x2f, 0x75, 0x6e, 0x61, 0x6d, 0x65, 0x00, 0x00, 
	0x2f, 0x65, 0x78, 0x65, 0x63, 0x76, 0x65, 0x00, 
	0x00, 0x2f, 0x67, 0x65, 0x74, 0x63, 0x77, 0x64, 
	0x00, 0x00, 0x2f, 0x6d, 0x6b, 0x64, 0x69, 0x72, 
	0x5f, 0x00, 0x00, 0x2f, 0x67, 0x65, 0x74, 0x64, 
	0x65, 0x6e, 0x74, 0x73, 0x00, 0x00, 0x2f, 0x73, 
	0x6c, 0x65, 0x65, 0x70, 0x00, 0x00, 0x2f, 0x79, 
	0x69, 0x65, 0x6c, 0x64, 0x00, 0x00, 0x2f, 0x77, 
	0x61, 0x69, 0x74, 0x70, 0x69, 0x64, 0x00, 0x00, 
	0x2f, 0x64, 0x75, 0x70, 0x32, 0x00, 0x00, 0x2f, 
	0x63, 0x6c, 0x6f, 0x6e, 0x65, 0x00, 0x00, 0x2f, 
	0x63, 0x68, 0x64, 0x69, 0x72, 0x00, 0x00, 0x2f, 
	0x6d, 0x75, 0x6e, 0x6d, 0x61, 0x70, 0x00, 0x00, 
	0x2f, 0x64, 0x75, 0x70, 0x00, 0x00, 0x2f, 0x77, 
	0x61, 0x69, 0x74, 0x00, 0x00, 0x2f, 0x67, 0x65, 
	0x74, 0x70, 0x70, 0x69, 0x64, 0x00, 0x00, 0x2f, 
	0x6f, 0x70, 0x65, 0x6e, 0x00, 0x00, 0x2f, 0x74, 
	0x65, 0x73, 0x74, 0x5f, 0x65, 0x63, 0x68, 0x6f, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
};

#endif

#ifdef _hello
uchar initcode[] = {
   0x13, 0x00, 0x00, 0x00,     // nop
   0x13, 0x00, 0x00, 0x00,     // nop 
   0x13, 0x00, 0x00, 0x00,     // nop 
	   // <start>
   0x17, 0x05, 0x00, 0x00,     // auipc a0, 0x0 
   0x13, 0x05, 0x05, 0x00,     // mv a0, a0 
   0x93, 0x08, 0x60, 0x01,     // li a7, 22 
   0x73, 0x00, 0x00, 0x00,     // ecall 
   0xef, 0xf0, 0x1f, 0xff,     // jal ra, <start>
   // <loop>
   0xef, 0x00, 0x00, 0x00,     // jal ra, <loop>
};//printhello
#endif
int initcodesize=sizeof(initcode);
